<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>学院管理</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f9f9f9;
            margin: 0;
            padding: 20px;
        }

        .container {
            max-width: 800px;
            margin: 0 auto;
            background-color: #fff;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            padding: 20px;
        }

        h2 {
            color: #333;
        }

        .btn {
            display: inline-block;
            padding: 8px 16px;
            text-decoration: none;
            color: white;
            border-radius: 4px;
            font-size: 14px;
            cursor: pointer;
            border: none;
            transition: background-color 0.3s ease;
        }

        .btn-success {
            background-color: #28a745;
        }

        .btn-success:hover {
            background-color: #218838;
        }

        .btn-primary {
            background-color: #007bff;
        }

        .btn-primary:hover {
            background-color: #0069d9;
        }

        .btn-danger {
            background-color: #dc3545;
        }

        .btn-danger:hover {
            background-color: #c82333;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }

        th, td {
            padding: 12px;
            border: 1px solid #ddd;
            text-align: left;
        }

        th {
            background-color: #f2f2f2;
            color: #333;
        }

        tr:hover {
            background-color: #f1f1f1;
        }

        .mb-3 {
            margin-bottom: 15px;
        }
    </style>
</head>
<body>

<div class="container">
    <h2>学院管理</h2>
    <a th:href="@{/college/add}" class="btn btn-success mb-3">新增学院</a>
    <table>
        <thead>
        <tr>
            <th>ID</th>
            <th>学院名称</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="college : ${colleges}">
            <td th:text="${college.collegeId}"></td>
            <td th:text="${college.collegeName}"></td>
            <td>
                <a th:href="@{/college/edit/{id}(id=${college.collegeId})}" class="btn btn-primary btn-sm">编辑</a>
                <a th:href="@{/college/delete/{id}(id=${college.collegeId})}"
                   class="btn btn-danger btn-sm"
                   onclick="return confirm('确定删除？')">删除</a>
            </td>
        </tr>
        </tbody>
    </table>
</div>

</body>
</html>
